using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects {
	public static class BO_cms_messages {
		public static DataTable SelectAll() {
			try {
				usp_cms_messages_select_all entity = new usp_cms_messages_select_all();

				return BO_Actions<usp_cms_messages_select_all>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows) {
			try {
				usp_cms_messages_select_top entity = new usp_cms_messages_select_top();
				entity.NUMBERRECORD = rows;

				return BO_Actions<usp_cms_messages_select_top>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable Search(int msg_id) {
			try {
				usp_cms_messages_search entity = new usp_cms_messages_search();
				entity.MSG_ID = msg_id;

				return BO_Actions<usp_cms_messages_search>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount) {
			try {
				usp_cms_messages_select_paged entity = new usp_cms_messages_select_paged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;

				return BO_Actions<usp_cms_messages_select_paged>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static string Insert( Int64 parent_id, int user_sender_id, int user_receiver_id, string msg_title, string msg_details, DateTime msg_send_date, int msg_status) {
			try {
				usp_cms_messages_insert entity = new usp_cms_messages_insert();
                entity.PARENT_ID = parent_id;
                entity.USER_SENDER_ID = user_sender_id;
                entity.USER_RECEIVER_ID = user_receiver_id;
                entity.MSG_TITLE = msg_title;
                entity.MSG_DETAILS = msg_details;
                entity.MSG_SEND_DATE = msg_send_date;
                entity.MSG_STATUS = msg_status;

				return BO_Actions<usp_cms_messages_insert>.ExecuteAndReturnStringValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static string Update( Int64 msg_id, Int64 parent_id, int user_sender_id, int user_receiver_id, string msg_title, string msg_details, DateTime msg_send_date, int msg_status) {
			try {
				usp_cms_messages_update entity = new usp_cms_messages_update();
                entity.MSG_ID = msg_id;
                entity.PARENT_ID = parent_id;
                entity.USER_SENDER_ID = user_sender_id;
                entity.USER_RECEIVER_ID = user_receiver_id;
                entity.MSG_TITLE = msg_title;
                entity.MSG_DETAILS = msg_details;
                entity.MSG_SEND_DATE = msg_send_date;
                entity.MSG_STATUS = msg_status;

				return BO_Actions<usp_cms_messages_update>.ExecuteAndReturnStringValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
	}
}

